package main
import(
	"fmt"
)

//定义一个结构体
type Teacher struct{
  Name string
  Age int
  School string
}
func main(){
  //方式2
  var t1  Teacher
  fmt.Println(t1) //默认{ 0 }
  t1.Name = "eric"
  t1.Age = 34
  t1.School = "bowen"
  fmt.Println(t1)
  fmt.Println(t1.Age + 10)
  //方式2
  var t Teacher = Teacher{"gwq",33,"niujing"}
  fmt.Println(t)
  //方式3
  var t2 *Teacher = new(Teacher)//t2是指针，地址，给指向赋值
  (*t2).Name = "GG"
  (*t2).Age = 12
  t2.School = "DX"
  fmt.Println(*t2)
  //方式4
  var t3 *Teacher = &Teacher{}
  (*t3).Name = "GG"
  (*t3).Age = 12
  t2.School = "DX"
  fmt.Println(*t3)
}
